-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix passing empty masterkey #585
Fix passing empty masterkey #585
Conversation
@curquiza I didn't revert to the previous behaviour, instead I opted for an check if the user provided an empty string. Empty string can not be passed via authorization anyway so I think this should be safe |
Co-authored-by: Tomas Norkūnas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On new major release I'd leave as is documenting that non-empty-string or null are accepted, so maybe a note for future could be added
tests/Http/ClientTest.php
Outdated
if ('Authorization' === $name) { | ||
$this->assertSame('Bearer ', $value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually tests the wrong thing. I'll update the test now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, should be if ('Authorization' === $name) { self::fail(); }
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the second thought, as there is $this->once()
, the else case will never be reached I think.
so this would be enough:
$requestStub->expects($this->once())
->method('withAddedHeader')
->willReturnCallback(function ($name, $value) use ($requestStub) {
$this->assertSame('User-Agent', $name);
$this->assertSame(Meilisearch::qualifiedVersion(), $value);
@norkunas I don't quite understand. What do you exactly mean? |
I mean to add a note about #514 (comment) to not forget it in future :) |
Co-authored-by: Tomas Norkūnas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Maybe we should add deprecation? |
bors try |
tryBuild failed: |
@mmachatschek @norkunas I think the tests are still failing 😕 |
@curquiza @brunoocasali I pushed the fix. lets retry with bors |
Strange to have two Client classes :) |
bors merge |
585: Fix passing empty masterkey r=norkunas a=mmachatschek # Pull Request ## Related issue Fixes #584 ## What does this PR do? - Fix the issue by also checking if the provided masterkey is an empty string ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: Markus Machatschek <[email protected]> Co-authored-by: Bruno Casali <[email protected]>
This PR was included in a batch that successfully built, but then failed to merge into main. It will not be retried. Additional information: {"message":"At least 1 approving review is required by reviewers with write access.","documentation_url":"https://docs.github.com/articles/about-protected-branches"} |
bors merge |
Pull Request
Related issue
Fixes #584
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!